to obtain only one element, then uses $divs[0] obtains is this element's native DOM object, this is the jquery object to the native DOM object.With the understanding above, the native DOM object to the jquery object is much simpler to understand, the $ (Native
elementElement.srcThe above method can be found to get some object properties and can be implemented using DOM Core or html_dom implementation, compared to the html_dom implementation is relatively short, but it can only be used to work with Web documents.3.css_domCss_dom is a CSS-based operation, in JavaScript in China, the main function of Css_dom technology is to get and set the various properties of the style object, by changing the style object'
style attr ("Class", "MyClass").
/* Note: One parameter is get, two parameters are set */
2. Append Style
Append style addclass("MyClass") (does not affect other styles)
The style that is said here is written in CSS. MyClass is the selector name for CSS
3. Remove Style
Remove the style removeclass("MyClass"),
4. Toggle Style
Toggle Style (style is removed if there is a style, and style is added if no style is present)
toggleclass("MyClass").
5. Judging
determine if ther
JQuery's operations on the DOM are also very important. 1. Three simple and practical jQuery methods for DOM operations: text ()-Sets or returns the text content of the selected element HTML ()-Sets or returns the selected Element (including HTML markup) val ()-Sets or returns the value of the form field 2.attr () Get Properties . Of course, these tw
The DOM property operation is to read, set, and remove the properties of the DOM element, such as prop (), Removeprop ().1. Prop () 1.1 Get return value using Prop ()Prop () returns the value of the first matching element when it returns a property value.1234567 - - - + -1.2 Use prop () to set the property value 1.2.1 use Prop () to set a single property value1234567 - - the - -The result of the execution i
jquery handles DOM element-property manipulation1 //properties of the action element:2$ (' * '). each (function(n) {3 This. ID = This. TagName +N; 4 })5 6 //Get property value:7$ ('). attr (' '); 8 9 //To set the property value:Ten //set a value for a property One$ (' * '). attr (' title ',function(index, previousvalue) { A returnPreviousvalue + ' I am element ' + index + ' and my name is ' + This. ID;
jquery Gets the parent node, the sibling node, and inserts the content within the node.①$ ("#test1"). Parent ()//②$ ("#test1"). Next ()//Next node ③$ ("#test1"). Append (' Summary: At the time of writing JS, we must first determine whether the JavaScript or jquery, because the two different ways, the method name is not the same, can not be mixed.jquery DOM Elemen
Dom:123456 - - + - + A at - - - - - the -Jquery:1234567 - + - + A at - - - - - in - to + - the * $Panax Notoginseng - the + A the - $DOM manipulation and jquery implementation options move operations
() hasclass ( )//returns a Boolean value equivalent to IS (". ClassName")//css-dom operation, but appears in the presentation layer, using class insteadCSS ()//usage with attr (), quoted, "-" with hump-type replacementcss"Opacity","0~1")//Set Transparencyheight ()/width () height ( -)/height ("10em")//default unit pxoffset (). Left/top position (). Left/topscrolltop ()/scrollleft ()//distance from top and left of scroll barV. Getting and setting HTML
The general jquery in the Web project as long as the function is to value and assignment.Below are the Getting started, these are worth getting. JQuery (iii) DOM manipulation
() Gets the previous sibling element immediately adjacent to each element in the matching element collection, optionally filtered by the selector.. Prevall () gets all the sibling elements before each element in the matching element collection, which is optionally filtered by the selector.. Prevuntil () obtains all the sibling elements before each element until it encounters an element that matches the selector.. Siblings () Gets the sibling elements of all elements in the matching element coll
. in the JAvaScript Loading in XML There are two ways in which a document ① load the same domain XML documentation. ② loads a string representing XML. can take advantage Domapi for XML (in some ways XML is used to store data, which allows the user to customize markup in XML) the operation. DOM serialization of objects becomes XML string. is to speak the XML file content of all parties as a string. this is to put a XML The document is exported as a
the same domain XML documentation. ② loads a string representing XML . can use Domapi for XML (in some ways XML is used to store data, allowing users to define their own tags in XML) the operation. DOM serialization of objects becomes XML string. is to say XML the file content of all parties as a string. this is to put a XML The document is exported as a string. The production of XPath technology:because the use getElementById or Get Elementbytagname
HTML CREATE TABLE:Instead, the DOM is created by:window.onload=function() { var table=document.createelement (' table '); Table.width=300; Table.border=1;}Use the AppendChild () method to add a table's THEAD, tr,th. Such as:var thead=document.createelement (' thead '); Table.appendchild (thead);As you can see, creating tables using the DOM is tiring.Here's a look at how to get tabular data using th
The front-end development in order to achieve a certain purpose, often there are many ways: Dom core,html dom,jquery; Dom Core/jquery obtains property values primarily through function calls (GetAttribute ("property name")/attr ("Property name"), and the HTML
matches the pattern, or null if no matching element is found. If an unsupported selector is passed in, the method throws an error. // get BODY element body = Document.queryselector ("Body" // var main = Document.queryselector ("#main" // Gets the first element of the class named List var list = Document.queryselector (". List" // var div = main.queryselector (". List" The way to get DOM elements is very much like
dom|xml| Conversion
This article briefly describes the concept and internal logic structure of DOM, which describes the Java implementation process of DOM document manipulation and XML file conversion.
1. Introduction to Dom
Currently, the consortium has introduced the speci
Java implementation of dom|xml| conversion DOM document manipulation and XML file conversion
[Author: Guo Hongfeng Add Time: 2001-10-19 8:16:09]
Guo Hongfeng (ghf_email@sohu.com)
Introduction: This paper briefly describes the concept and internal logic structure of DOM, and gives the Java implementation process
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.